﻿# CMakeList.txt: dl_tarot 的 CMake 项目，在此处包括源代码并定义
# 项目特定的逻辑。
#
cmake_minimum_required (VERSION 3.8)

# 如果支持，请为 MSVC 编译器启用热重载。
if (POLICY CMP0141)
  cmake_policy(SET CMP0141 NEW)
  set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

project ("dl_tarot")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>")


FILE(GLOB_RECURSE SRC_LIST CONFIGURE_DEPENDS "src/*.cpp" "src/*.h")
#aux_source_directory(${PROJECT_SOURCE_DIR} SRC_LIST)
# 将源代码添加到此项目的可执行文件。
add_executable (dl_tarot ${SRC_LIST})

if (CMAKE_VERSION VERSION_GREATER 3.12)
  set_property(TARGET dl_tarot PROPERTY CXX_STANDARD 23)
endif()

# 链接dl库
if (CMAKE_BUILD_TYPE MATCHES "Debug")
	set(DL_INSTALL_PATH ${CMAKE_SOURCE_DIR}/../dl/out/install/x64-debug)
else()
	set(DL_INSTALL_PATH ${CMAKE_SOURCE_DIR}/../dl/out/install/x64-release)
endif()

include_directories(${DL_INSTALL_PATH}/include)
#include_directories(${DL_INSTALL_PATH}/include/dl)
include_directories(${CMAKE_SOURCE_DIR}/../dl/dl)

if (CMAKE_BUILD_TYPE MATCHES "Debug")
set(DL_LIB_LIST
dl.lib
vld.lib
libiconvStatic.lib
fmtd.lib
freetyped.lib
glfw3.lib
lunasvg.lib
lz4.lib
libwebp.lib
OpenAL32.lib
ogg.lib
vorbis.lib
vorbisfile.lib
FLAC.lib)
else()
set(DL_LIB_LIST
dl.lib
vld.lib
libiconvStatic.lib
fmt.lib
freetype.lib
glfw3.lib
lunasvg.lib
lz4.lib
libwebp.lib
OpenAL32.lib
ogg.lib
vorbis.lib
vorbisfile.lib
FLAC.lib)
endif()

foreach(var ${DL_LIB_LIST})
	target_link_libraries(${PROJECT_NAME} PRIVATE ${DL_INSTALL_PATH}/lib/${var})
endforeach()

# vulkan
find_package(Vulkan REQUIRED)
include_directories(${Vulkan_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${Vulkan_LIBRARIES})

# 拷贝资源文件
add_custom_command(TARGET ${PROJECT_NAME}
    POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_directory
	${CMAKE_SOURCE_DIR}/res ${CMAKE_CURRENT_BINARY_DIR})

